package com.cec.controller.user;


import com.cec.dto.ActivityDTO;
import com.cec.entity.Activity;
import com.cec.result.Result;
import com.cec.service.user.UserActivityService;
import com.cec.vo.CategoryVO;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 活动表 前端控制器
 * </p>
 *
 * @author lt
 * @since 2024-10-25
 */
@Slf4j
@RestController
@RequestMapping("/user/activity")
public class UserActivityController {
    @Autowired
    private UserActivityService userActivityService;
    @GetMapping
    @ApiOperation("分页查询")
    public Result pageQueryActivity(ActivityDTO activityDTO){
        return userActivityService.pageQueryActivityList(activityDTO);
    }

    @GetMapping("/{id}")
    @ApiOperation("通过id查询活动信息")
    public Result queryActivityById(@PathVariable Long id){
        Activity activity = userActivityService.queryActivityById(id);
        return Result.success(activity);
    }

    @GetMapping("/type")
    @ApiOperation("查询活动分类")
    public Result queryActivityType(){
        List<CategoryVO> activityTypeList = userActivityService.queryActivityType();
        return Result.success(activityTypeList);
    }
}

